package com;

import android.content.Context;

public class FaceNeuralNetwork {
    static {
        System.loadLibrary("facedetection");
    }

    //enum imagetype
    public static int ImageYuv420P = 1;
    public static int ImageYuv420SP = 2;
    public static int ImageRGB888 = 3;
    public static int ImageBMP = 4;
    public static int ImageJpeg = 5;
    public static int ImagePng = 6;
    //enum errorcode
    public static int NoneError = 1;
    public static int NotActived = 2;
    public static int ImageIsEmpty = 3;
    public static int FaceDetectFailed = 4;

    //enum enable
    public static int EnableMonocularLiving = 1;
    public static int EnableBinocularLiving = (1 << 1);
    public static int EnableFaceLandarks = (1 << 2);
    public static int EnableAgeGender = (1 << 3);
    public static int EnableBlink = (1 << 4);
    public static int EnableQuality = (1 << 5);

    public static native String GetMachineCode(Context context);

    public static native int ActiveLibrary(Context context, String Authorization);

    public static native void SetMinFace(int MinSize);

    public static native void SetThreadCount(int nCount);

    public static native void SetUseEnable(int Enabled);

    public static native String FaceDetect(byte[] ImageData, int DataLen, int nWidth, int nHeight, int ImageType, int Angle);

    public static native String FaceDetectMax(byte[] ImageData, int DataLen, int nWidth, int nHeight, int ImageType, int Angle);

    public static native String BinocularLivingDetect(byte[] ImageDataIr, int DataLenIr, int nWidthIr, int nHeightIr, int ImageTypeIr, int AngleIr,
                                                      byte[] ImageDataBgr, int DataLenBgr, int nWidthBgr, int nHeightBgr, int ImageTypeBgr, int AngleBgr);

    public static native String GetFaceFeautre(byte[] ImageData, int DataLen, int nWidth, int nHeight, int ImageType, int Angle, float[] Point);

    public static native float FaceCompare(byte[] ImageDataOne, int DataLenOne, int nWidthOne, int nHeightOne, int ImageTypeOne, int AngleOne, float[] PointOne,
                                           byte[] ImageDataTwo, int DataLenTwo, int nWidthTwo, int nHeightTwo, int ImageTypeTwo, int AngleTwo, float[] PointTwo);

    public static native float MaxFaceCompare(byte[] ImageDataOne, int DataLenOne, int nWidthOne, int nHeightOne, int ImageTypeOne, int AngleOne,
                                              byte[] ImageDataTwo, int DataLenTwo, int nWidthTwo, int nHeightTwo, int ImageTypeTwo, int AngleTwo);

    public static native float FaceFeatureCompare(byte[] ImageData, int DataLen, int nWidth, int nHeight, int ImageType, int Angle, float[] Point, String Feaute);

    public static native float MaxFaceFeatureCompare(byte[] ImageData, int DataLen, int nWidth, int nHeight, int ImageType, int Angle, String Feaute);

    public static native float FeautreCompare(String FeauteOne, String FeautreTwo);

    public interface OnGetRGBListener {
        public int onImageChange(int[] ImageData, int DataLen, int OutWidth, int OutHeight);
    }

    public static native int SetRGBCallBack(OnGetRGBListener Listener, int OutWidth, int OutHeight);
}